package ExecutorService;

import java.util.concurrent.*;

public class Demo1 {
    public static void main(String[] args) {
        ExecutorService ex=new ThreadPoolExecutor(5,10,10, TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
        Runnable r=new MyRunnable();
        ex.execute(r);
        ex.execute(r);
        ex.execute(r);
    }
}
 class MyRunnable implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName() +":"+ i);
        }
    }
}